<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>Amaze UI Admin index Examples</title>
    <meta name="description" content="这是一个 index 页面">
    <meta name="keywords" content="index">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="renderer" content="webkit">
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <link rel="icon" type="image/png" href="/Public/assets/i/favicon.png">
    <link rel="apple-touch-icon-precomposed" href="/Public/assets/i/app-icon72x72@2x.png">
    <meta name="apple-mobile-web-app-title" content="Amaze UI" />
    <link rel="stylesheet" href="/Public/assets/css/amazeui.min.css" />
    <link rel="stylesheet" href="/Public/assets/css/amazeui.datatables.min.css" />
    <link rel="stylesheet" href="/Public/assets/css/app.css">
    <script src="/Public/assets/js/jquery.min.js"></script>

</head>

<body data-type="widgets">
    <script src="/Public/assets/js/theme.js"></script>
    <div class="am-g tpl-g">
        <!-- 头部 -->
        <header>
            <!-- logo -->
            <div class="am-fl tpl-header-logo">
                <a href="javascript:;"><img src="/Public/images/title4.png" alt="" style="width:50px;height:50px;"></a>
            </div>
            <!-- 右侧内容 -->
            <div class="tpl-header-fluid">
                <!-- 侧边切换 -->
                <div class="am-fl tpl-header-switch-button am-icon-list">
                    <span>

                </span>
                </div>
                <!-- 搜索 -->
                <div class="am-fl tpl-header-search">
                    <form class="tpl-header-search-form" action="javascript:;">
                        <button class="tpl-header-search-btn am-icon-search"></button>
                        <input class="tpl-header-search-box" type="text" placeholder="搜索内容...">
                    </form>
                </div>
                <!-- 其它功能-->
                <div class="am-fr tpl-header-navbar">
                    <ul>
                        <!-- 欢迎语 -->
                        <li class="am-text-sm tpl-header-navbar-welcome">
                            <a href="javascript:;">欢迎你, <span><?php echo ($_SESSION['name']); ?></span> </a>
                        </li>

                        <!-- 新邮件 -->
                      <!--   <li class="am-dropdown tpl-dropdown" data-am-dropdown>
                            <a href="javascript:;" class="am-dropdown-toggle tpl-dropdown-toggle" data-am-dropdown-toggle>
                                <i class="am-icon-envelope"></i>
                                <span class="am-badge am-badge-success am-round item-feed-badge">4</span>
                            </a> -->
                            <!-- 弹出列表 -->
                            <ul class="am-dropdown-content tpl-dropdown-content">
                               <!--  <li class="tpl-dropdown-menu-messages">
                                    <a href="javascript:;" class="tpl-dropdown-menu-messages-item am-cf">
                                        <div class="menu-messages-ico">
                                            <img src="/Public/assets/img/user04.png" alt="">
                                        </div>
                                        <div class="menu-messages-time">
                                            3小时前
                                        </div>
                                        <div class="menu-messages-content">
                                            <div class="menu-messages-content-title">
                                                <i class="am-icon-circle-o am-text-success"></i>
                                                <span>夕风色</span>
                                            </div>
                                            <div class="am-text-truncate"> Amaze UI 的诞生，依托于 GitHub 及其他技术社区上一些优秀的资源；Amaze UI 的成长，则离不开用户的支持。 </div>
                                            <div class="menu-messages-content-time">2016-09-21 下午 16:40</div>
                                        </div>
                                    </a>
                                </li> -->

                                <li class="tpl-dropdown-menu-messages">
                                    <a href="javascript:;" class="tpl-dropdown-menu-messages-item am-cf">
                                        <div class="menu-messages-ico">
                                            <img src="/Public/assets/img/user02.png" alt="">
                                        </div>
                                        <div class="menu-messages-time">
                                            5天前
                                        </div>
                                        <div class="menu-messages-content">
                                            <div class="menu-messages-content-title">
                                                <i class="am-icon-circle-o am-text-warning"></i>
                                                <span>禁言小张</span>
                                            </div>
                                            <div class="am-text-truncate"> 为了能最准确的传达所描述的问题， 建议你在反馈时附上演示，方便我们理解。 </div>
                                            <div class="menu-messages-content-time">2016-09-16 上午 09:23</div>
                                        </div>
                                    </a>
                                </li>
                               <!--  <li class="tpl-dropdown-menu-messages">
                                    <a href="javascript:;" class="tpl-dropdown-menu-messages-item am-cf">
                                        <i class="am-icon-circle-o"></i> 进入列表…
                                    </a>
                                </li> -->
                            </ul>
                        </li>

                        <!-- 新提示 -->
                        <li class="am-dropdown" data-am-dropdown>
                           <!--  <a href="javascript:;" class="am-dropdown-toggle" data-am-dropdown-toggle>
                                <i class="am-icon-bell"></i>
                                <span class="am-badge am-badge-warning am-round item-feed-badge">5</span>
                            </a> -->

                            <!-- 弹出列表 -->
                            <ul class="am-dropdown-content tpl-dropdown-content">
                                <li class="tpl-dropdown-menu-notifications">
                                    <a href="javascript:;" class="tpl-dropdown-menu-notifications-item am-cf">
                                        <div class="tpl-dropdown-menu-notifications-title">
                                            <i class="am-icon-line-chart"></i>
                                            <span> 有6笔新的销售订单</span>
                                        </div>
                                        <div class="tpl-dropdown-menu-notifications-time">
                                            12分钟前
                                        </div>
                                    </a>
                                </li>
                                <li class="tpl-dropdown-menu-notifications">
                                    <a href="javascript:;" class="tpl-dropdown-menu-notifications-item am-cf">
                                        <div class="tpl-dropdown-menu-notifications-title">
                                            <i class="am-icon-star"></i>
                                            <span> 有3个来自人事部的消息</span>
                                        </div>
                                        <div class="tpl-dropdown-menu-notifications-time">
                                            30分钟前
                                        </div>
                                    </a>
                                </li>
                                <li class="tpl-dropdown-menu-notifications">
                                    <a href="javascript:;" class="tpl-dropdown-menu-notifications-item am-cf">
                                        <div class="tpl-dropdown-menu-notifications-title">
                                            <i class="am-icon-folder-o"></i>
                                            <span> 上午开会记录存档</span>
                                        </div>
                                        <div class="tpl-dropdown-menu-notifications-time">
                                            1天前
                                        </div>
                                    </a>
                                </li>


                                <li class="tpl-dropdown-menu-notifications">
                                    <a href="javascript:;" class="tpl-dropdown-menu-notifications-item am-cf">
                                        <i class="am-icon-bell"></i> 进入列表…
                                    </a>
                                </li>
                            </ul>
                        </li>

                        <!-- 退出 -->
                        <li class="am-text-sm">
                            <a href="/Admin/Login/out">
                                <span class="am-icon-sign-out"></span> 退出
                            </a>
                        </li>
                    </ul>
                </div>
            </div>

        </header>
        <!-- 风格切换 -->
        <div class="tpl-skiner">
            <div class="tpl-skiner-toggle am-icon-cog">
            </div>
            <div class="tpl-skiner-content">
                <div class="tpl-skiner-content-title">
                    选择主题
                </div>
                <div class="tpl-skiner-content-bar">
                    <span class="skiner-color skiner-white" data-color="theme-white"></span>
                    <span class="skiner-color skiner-black" data-color="theme-black"></span>
                </div>
            </div>
        </div>
        <!-- 侧边导航栏 -->
        <div class="left-sidebar">
            <!-- 用户信息 -->
            <div class="tpl-sidebar-user-panel">
                <div class="tpl-user-panel-slide-toggleable">
                    <div class="tpl-user-panel-profile-picture">
                        <img src="/Public/assets/img/user04.png" alt="">
                    </div>
                    <span class="user-panel-logged-in-text">
              <i class="am-icon-circle-o am-text-success tpl-user-panel-status-icon"></i>
              <?php echo ($_SESSION['name']); ?>
          </span>
                    <a href="javascript:;" class="tpl-user-panel-action-link"> <span class="am-icon-pencil"></span> 账号设置</a>
                </div>
            </div>

            <!-- 菜单 -->
            <ul class="sidebar-nav">
                
                <li class="sidebar-nav-link">
                    <a href="javascript:;" class="sidebar-nav-sub-title">
                        <i class="am-icon-table sidebar-nav-link-logo"></i> 产品管理
                        <span class="am-icon-chevron-down am-fr am-margin-right-sm sidebar-nav-sub-ico"></span>
                    </a>
                    <ul class="sidebar-nav sidebar-nav-sub">
                        <li class="sidebar-nav-link">
                            <a href="/Admin/Product/index">
                                <span class="am-icon-angle-right sidebar-nav-link-logo"></span> 添加产品
                            </a>
                        </li>
                        <li class="sidebar-nav-link">
                            <a href="/Admin/Product/edit">
                                <span class="am-icon-angle-right sidebar-nav-link-logo"></span> 产品修改
                            </a>
                        </li>

                        <li class="sidebar-nav-link">
                            <a href="/Admin/Column/index">
                                <span class="am-icon-angle-right sidebar-nav-link-logo"></span> 栏目管理
                            </a>
                        </li>
                        <li class="sidebar-nav-link">
                            <a href="/Admin/Property/index">
                                <span class="am-icon-angle-right sidebar-nav-link-logo"></span> 产品属性管理
                            </a>
                        </li>
                    </ul>
                </li>
                <li class="sidebar-nav-link">
                    <a href="javascript:;" class="sidebar-nav-sub-title">
                        <i class="am-icon-table sidebar-nav-link-logo"></i>定单管理
                        <span class="am-icon-chevron-down am-fr am-margin-right-sm sidebar-nav-sub-ico"></span>
                    </a>
                    <ul class="sidebar-nav sidebar-nav-sub">
                        <li class="sidebar-nav-link">
                            <a href="/Admin/Address/index">
                                <span class="am-icon-angle-right sidebar-nav-link-logo"></span> 地址选项管理
                            </a>
                        </li>
                        <li class="sidebar-nav-link">
                            <a href="/Admin/Delivery/index">
                                <span class="am-icon-angle-right sidebar-nav-link-logo"></span> 发货管理
                            </a>
                        </li>
                        <li class="sidebar-nav-link">
                            <a href="/Admin/Custondelivery/index">
                                <span class="am-icon-angle-right sidebar-nav-link-logo"></span> 收货管理
                            </a>
                        </li>
                        <li class="sidebar-nav-link">
                            <a href="/Admin/Comment/index">
                                <span class="am-icon-angle-right sidebar-nav-link-logo"></span> 评论管理
                            </a>
                        </li>
                       
                    </ul>
                </li>
                <li class="sidebar-nav-link">
                    <a href="/Admin/Signup/index">
                        <i class="am-icon-clone sidebar-nav-link-logo"></i> 注册
                       
                    </a>
                </li>
                <li class="sidebar-nav-link">
                    <a href="/Admin/Login/index">
                        <i class="am-icon-key sidebar-nav-link-logo"></i> 登录
                    </a>
                </li>
                

            </ul>
        </div>



        <!-- 内容区域 -->
        <div class="tpl-content-wrapper">
            <div class="row-content am-cf">
                <div class="row">
                    <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
                        <div class="widget am-cf">
                            <div class="widget-head am-cf">
                                <div class="widget-title  am-cf">文章列表</div>


                            </div>
                            <div class="widget-body  am-fr">

                                <div class="am-u-sm-12 am-u-md-6 am-u-lg-6">
                                    <div class="am-form-group">
                                        <div class="am-btn-toolbar">
                                            <div class="am-btn-group am-btn-group-xs">
                                                <button type="button" class="am-btn am-btn-default am-btn-success"><span class="am-icon-plus"></span> 新增</button>
                                                <button type="button" class="am-btn am-btn-default am-btn-secondary"><span class="am-icon-save"></span> 保存</button>
                                                <button type="button" class="am-btn am-btn-default am-btn-warning"><span class="am-icon-archive"></span> 审核</button>
                                                <button type="button" class="am-btn am-btn-default am-btn-danger"><span class="am-icon-trash-o"></span> 删除</button>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div class="am-u-sm-12 am-u-md-6 am-u-lg-3">
                                    <div class="am-form-group tpl-table-list-select">
                                        <select data-am-selected="{btnSize: 'sm'}">
              <option value="option1">所有类别</option>
              <option value="option2">IT业界</option>
              <option value="option3">数码产品</option>
              <option value="option3">笔记本电脑</option>
              <option value="option3">平板电脑</option>
              <option value="option3">只能手机</option>
              <option value="option3">超极本</option>
            </select>
                                    </div>
                                </div>
                                <div class="am-u-sm-12 am-u-md-12 am-u-lg-3">
                                    <div class="am-input-group am-input-group-sm tpl-form-border-form cl-p">
                                        <input type="text" class="am-form-field ">
                                        <span class="am-input-group-btn">
            <button class="am-btn  am-btn-default am-btn-success tpl-table-list-field am-icon-search" type="button"></button>
          </span>
                                    </div>
                                </div>

                                <div class="am-u-sm-12">
                                    <table width="100%" class="am-table am-table-compact am-table-striped tpl-table-black ">
                                        <thead>
                                            <tr>
                                                <th>产品缩略图</th>
                                                <th>产品标题</th>
                                                <th>价格</th>
                                                <th>原始价格</th>
                                               

                                                <th>操作</th>
                                            </tr>
                                        </thead>
                                        <tbody id="tbody">
                                        <?php if(is_array($data)): $i = 0; $__LIST__ = $data;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$val): $mod = ($i % 2 );++$i;?><tr class="gradeX" onclick="showComment(this) " alt="<?php echo ($val["id"]); ?>">
                                                <td>
                                                    <img src="<?php echo ($val["images"]); ?>" alt="" style="width:50px;height:50px">
                                                </td>
                                                <td class="am-text-middle"><?php echo ($val["title"]); ?></td>
                                                 
                                                <td class="am-text-middle"><?php echo ($val["price"]); ?></td>
                                                <td class="am-text-middle"><?php echo ($val["originprice"]); ?></td>
                                                <td class="am-text-middle">
                                                    <div class="tpl-table-black-operation">
                                                        <a href="/Admin/Product/change?id=<?php echo ($val["id"]); ?>">
                                                            <i class="am-icon-pencil"></i> 编辑
                                                        </a>
                                                        <a href="/Admin/Product/delete?id=<?php echo ($val["id"]); ?>" class="tpl-table-black-operation-del">
                                                            <i class="am-icon-trash"></i> 删除
                                                        </a>
                                                    </div>
                                                </td>
                                            </tr>
                                             <tr class="answerComment">

                                             </tr><?php endforeach; endif; else: echo "" ;endif; ?>
                                            <!-- more data -->
                                        </tbody>
                                    </table>

                                </div>
                                <div class="am-u-lg-12 am-cf">

                                    <div class="am-fr">
                                        <ul class="am-pagination tpl-pagination">
                                            <li class="am-disabled"><a href="#">«</a></li>
                                            <li class="am-active"><a href="#">1</a></li>
                                            <li><a href="#">2</a></li>
                                            <li><a href="#">3</a></li>
                                            <li><a href="#">4</a></li>
                                            <li><a href="#">5</a></li>
                                            <li><a href="#">»</a></li>
                                        </ul>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    </div>
    <script type="text/html" id="showCom">
        <td style="width:100%;min-height:200px;border:1px solid blue;overflow:hidden" colspan="5" class="tdComment">
                <%for(var i=0;i<data.length;i++){%>
                <div class="item23" pid="<%=data[i].pid%>" uid="<%=data[i].uid%>" id="<%=data[i].id%>">
                    <div style="width:100%;min-height:130px;overflow:hidden;">
                        <span><%=data[i].name%></span>评论于<span><%=getdate(data[i].time)%></span>&nbsp;&nbsp;&nbsp;<span style="color:red;font-size:15px"><%=data[i].grad%></span>
                        <br/>
                        <span>评论内容</span>
                        <p><%=data[i].content%></p>
                        <%if(data[i].answer!=null){%>
                            <span>客服回复:</span>
                            <span><%=data[i].answer%></span>
                        <%}%>
                        <br/>
                        <button style="background:blue" onclick="answer(this)">回复</button><br/>

                    </div>

                    <div class="answer">                    
                    </div>
                    <hr/>
                </div>
                <%}%>

               
        </td>

    </script>

    <script type="text/html" id="pushAnswer">
        <div class="pushText"  >
            <textarea name="text" id="" cols="30" rows="10" style="width:100%;height:110px;color:black" class="textCom" ></textarea>
             <br/>
            <button style="background:blue" onclick="push(this)" class="push">提交</button>
        </div>
    </script>
    <script src="/Public/assets/js/amazeui.min.js"></script>
    <script src="/Public/assets/js/app.js"></script>
    <script src="/Public/js/template-native.js"></script>
    <script type="text/javascript">
        function getLocalTime(nS) {  
            return new Date(parseInt(nS) * 1000).toLocaleString().replace(/:\d{1,2}$/,' ');  
        }
        function showComment(obj){
            
            var pid=$(obj).attr('alt');
            $.get('/Api/Index/getComDeta',{'pid':pid},function(ret){
                if (ret.status==true) {
                    template.helper('getdate',function(time){
                        return getLocalTime(time);
                    });
                    var html=template('showCom',ret);
                    $('.tdComment').remove();            
                    $(obj).next('.answerComment').html("");         
                    $(obj).next('.answerComment').append(html);
                }
            })
        }

        function answer(obj){
            $('.pushText').remove();
            var html=template('pushAnswer')
            $('.answerComment').find('.pushText').remove();
            $(obj).closest('.item23').find('.answer').append(html);

        }
        function push(obj){
            var pid=$(obj).closest('.item23').attr('pid');
            var param={};
            param.cid=$(obj).closest('.item23').attr('id');
            param.pid=$(obj).closest('.item23').attr('pid');
            param.uid=$(obj).closest('.item23').attr('uid');
            param.content=$(obj).closest('.item23').find('.textCom').val();
            if ( param.content==false) {alert('请输入回复内容');return}
            $.post('/Api/Index/pushAnCom',param,function(ret){
                if (ret!=false) {
                    alert('回复成功');
                    $(obj).closest('.item23').find('.answer').html("");
                    $.get('/Api/Index/getComDeta',{'pid':pid},function(ret){
                        if (ret.status==true) {
                            template.helper('getdate',function(time){
                                return getLocalTime(time);
                            });
                            var html=template('showCom',ret);
                            $('.tdComment').remove();            
                            $(obj).closest('.answerComment').html("");         
                            $(obj).closest('.answerComment').append(html);
                        }
                    })             
                }

            })        
        }
       
    </script>

</body>

</html>